﻿using Castle.DynamicProxy;

namespace WcfPOXCommunication
{
    public class ServiceFactory: IServiceFactory
    {
        private static readonly ProxyGenerator Generator = new ProxyGenerator();

        public T Create<T>() where T : class
        {
            return (T)Generator.CreateInterfaceProxyWithoutTarget(typeof(T),
                                                                  new ServiceInvokerProxy());
        }
    }
}